package com.konne.nightmare.FastPublicOpinion.ui.personal.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.konne.nightmare.FastPublicOpinion.R;
import com.konne.nightmare.FastPublicOpinion.base.BaseMvpActivity;
import com.konne.nightmare.FastPublicOpinion.base.BaseMvpPresenter;
import com.konne.nightmare.FastPublicOpinion.utils.LoadProgressDialog;
import com.konne.nightmare.FastPublicOpinion.ui.dialog.ConfirmDialog;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @Author: chen
 * @UpdateDate: 1/23/22
 * @UpdateRemark:
 */
public class MyPassphraseActivity extends BaseMvpActivity implements View.OnClickListener{

    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.img_back)
    ImageView imgBack;

    @Override
    protected BaseMvpPresenter createPresenter() {
        return new BaseMvpPresenter();
    }

    @Override
    public int getLayout() {
        return R.layout.activity_my_passphrase;
    }

    @Override
    public void initView() {
        initImmersionBar(R.color.white,true);
        tvTitle.setText("我的勤径口令");

    }

    @Override
    public void initData(Bundle savedInstanceState) {

    }
    @OnClick({R.id.img_back,R.id.ll_copy,R.id.ll_code})
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.ll_copy:
                showExitDialog();
                break;
            case R.id.ll_code:
                startActivity(new Intent(this, MyQRCodeActivity.class));
                break;



        }
    }
    /**
     * 弹窗
     */
    private void showExitDialog() {

        final ConfirmDialog dialog = new ConfirmDialog(this);
        dialog.setTitle("您的口令已复制");
        dialog.setMessageImage(R.mipmap.icon_switch_ball_on);
        dialog.setMessage("ALAN邀请你添加好友https://lanhuapp.com/url/odFM3-EDB4d分享人: 猫爷\n蓝湖团队: 勤径相关项目: 勤径app \n链接有效期: 20211208~[勤径口令]");
        dialog.setMessageColor(R.color.color_67788A);
        dialog.setOkButton("去微信粘贴", v -> {
            dialog.dismiss();

        });
        dialog.setCancelButton("取消", v -> dialog.dismiss());
        dialog.show();
    }
    @Override
    public LoadProgressDialog getLoadDialog() {
        return dialog;
    }

    @Override
    public void cancelLoadDialog() {
        if (dialog != null && dialog.isShowing()) {
            dialog.cancel();
        }
    }
}
